package com.gpb.common.method;

import java.util.ArrayList;
import java.util.List;

import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModelException;

/**
 * 首尾4位不变 中间星号
 * @author GuoPengBin
 * @dateTime Mar 25, 2014  2:43:45 PM
 */
public class AsteriskMethod implements TemplateMethodModel {

	public Object exec(List arg0) throws TemplateModelException {
		if(arg0.size()>0){
			StringBuffer sb=new StringBuffer();
			sb.append(arg0.get(0).toString().toCharArray());
			for (int i=sb.length()-5;i>3;i--) {
				sb.setCharAt(i, '*');
			}
			return sb.toString();
		}
		return null;
	}
	public static void main(String[] args)  throws TemplateModelException{
		List list=new ArrayList();
		list.add("622554546464646");
		System.out.println(new AsteriskMethod().exec(list));
	}
}
